package marek.barak.classes;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

import marek.barak.exceptions.InvalidMeasurementDataException;

public class Data implements Serializable {
	
	

	/**
	 * 
	 */
	private static final long serialVersionUID = 3615255048242703002L;

	public String getTypeOfRequest() {
		return typeOfRequest;
	}
	public String getGetTypeOfRequest() {
		return typeOfRequest;
	}
	public Date getRecievedOn() {
		return recievedOn;
	}
	public Date getAnnoucementDate() {
		return annoucementDate;
	}
	public Date getTargetDate() {
		return targetDate;
	}
	public Date getActualReleaseDate() {
		return actualReleaseDate;
	}
	public String getDeliveredOnTime() {
		return deliveredOnTime;
	}
	public String getComents() {
		return coments;
	}
	public String getDataChceckPerformedBy() {
		return dataChceckPerformedBy;
	}
	public Date getDateofBuddycheck() {
		return dateofBuddycheck;
	}
	public List<ActionMade> getActions() {
		return actions;
	}

	
	private String brand;
	private String typeOfRequest;
	private Date recievedOn;
	private Date annoucementDate;
	private Date targetDate;
	private Date actualReleaseDate;
	private String deliveredOnTime;
	private String coments;
	private String dataChceckPerformedBy;
	private Date dateofBuddycheck;
	private List<ActionMade> actions;
	
	@Override
	public String toString(){
		String done = "Brand: "+brand +
				"\nType of Request: "+typeOfRequest +
				"\nRecieved on: "+recievedOn +
				"\nAnnoucement date: "+ annoucementDate.toString() +
				"\nTarget date: "+ targetDate.toString() +
				"\nActual release date: "+actualReleaseDate.toString() +
				"\nDelivered on time: " + (deliveredOnTime==null? true:("False, Reason " +deliveredOnTime)) +
				"\nComents: "+coments +
				"\nData check performed by: "+dataChceckPerformedBy+
				"\nDate of buddy check: "+ dateofBuddycheck.toString()+"\n";
		for(ActionMade a: actions){
			done +=a.toString()+"\n";
		}
		return done;
				
		
		
	}
	//private Date 

	public String getBrand() {
		return brand;
	}
	private Data(){
		this.actions = Builder.getActions();
		this.actualReleaseDate = Builder.getActualReleaseDate();
		this.annoucementDate = Builder.getAnnoucementDate();
		this.brand = Builder.getBrand();
		this.coments= Builder.getComents();
		this.dataChceckPerformedBy = Builder.getDataChceckPerformedBy();
		this.dateofBuddycheck = Builder.getDateofBuddycheck();
		this.deliveredOnTime = Builder.getDeliveredOnTime();
		this.recievedOn = Builder.getRecievedOn();
		this.targetDate = Builder.getTargetDate();
		this.typeOfRequest = Builder.getTypeOfRequest();
		
	};
	
	public static class Builder {
		public static Date getRecievedOn() {
			return recievedOn;
		}

		public static void setRecievedOn(Date recievedOn) {
			Builder.recievedOn = recievedOn;
		}

		public static Date getAnnoucementDate() {
			return annoucementDate;
		}

		public static void setAnnoucementDate(Date annoucementDate) {
			Builder.annoucementDate = annoucementDate;
		}

		public static Date getTargetDate() {
			return targetDate;
		}

		public static void setTargetDate(Date targetDate) {
			Builder.targetDate = targetDate;
		}

		public static Date getActualReleaseDate() {
			return actualReleaseDate;
		}

		public static void setActualReleaseDate(Date actualReleaseDate) {
			Builder.actualReleaseDate = actualReleaseDate;
		}

		public static String getDeliveredOnTime() {
			return deliveredOnTime;
		}

		public static void setDeliveredOnTime(String deliveredOnTime) {
			Builder.deliveredOnTime = deliveredOnTime;
		}

		public static String getComents() {
			return coments;
		}

		public static void setComents(String coments) {
			Builder.coments = coments;
		}

		public static String getDataChceckPerformedBy() {
			return dataChceckPerformedBy;
		}

		public static void setDataChceckPerformedBy(String dataChceckPerformedBy) {
			Builder.dataChceckPerformedBy = dataChceckPerformedBy;
		}

		public static Date getDateofBuddycheck() {
			return dateofBuddycheck;
		}

		public static void setDateofBuddycheck(Date dateofBuddycheck) {
			Builder.dateofBuddycheck = dateofBuddycheck;
		}

		public static List<ActionMade> getActions() {
			return actions;
		}

		public static void setActions(List<ActionMade> actions) {
			Builder.actions = actions;
		}

		private static String brand;
		private static String typeOfRequest;
		private static Date recievedOn;
		private static Date annoucementDate;
		private static Date targetDate;
		private static Date actualReleaseDate;
		private static String deliveredOnTime;
		private static String coments;
		private static String dataChceckPerformedBy;
		private static Date dateofBuddycheck;
		private static List<ActionMade> actions;

		public static String getBrand() {
			return brand;
		}

		public static void setBrand(String brand) {
			Builder.brand = brand;
		}

		public static String getTypeOfRequest() {
			return typeOfRequest;
		}

		public static void setTypeOfRequest(String typeOfRequest) {
			Builder.typeOfRequest = typeOfRequest;
		}
		
		public static Data build() throws InvalidMeasurementDataException{
		
			return new Data();
		}
	}
	
	

}
